package com.wanmait.jd.service.impl;

import com.wanmait.jd.dao.ItemDao;
import com.wanmait.jd.pojo.Item;
import com.wanmait.jd.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service
@Transactional
public class ItemServiceImpl implements ItemService {
    @Autowired
    private ItemDao itemDao;

    @Override
    public void save(Item item) {

        this.itemDao.save(item);
    }

    @Override
    public List<Item> findll(Item item) {
        //声明查询条件
        Example<Item> example = Example.of(item);
        //根据查询条件就行查询数据
        List<Item> list = this.itemDao.findAll(example);
        return list;
    }
}
